package com.whnk.job.task;

import com.whnk.attendance.api.RemoteMonthEmpStatisService;
import com.whnk.attendance.api.vo.MonthEmpStatisBatchQueryVo;
import com.whnk.common.core.constant.Constants;
import com.whnk.common.core.domain.R;
import com.whnk.common.core.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 定时任务调度测试
 *
 * @author
 */
@Component("monthEmpStatisTask")
public class MonthEmpStatisTask
{
    @Autowired
    private RemoteMonthEmpStatisService remoteMonthEmpStatisService;

    public void start(String startMonth, String endMonth)
    {
        MonthEmpStatisBatchQueryVo monthEmpStatisBatchQueryVo = new MonthEmpStatisBatchQueryVo();
        monthEmpStatisBatchQueryVo.setStartMonth(startMonth);
        monthEmpStatisBatchQueryVo.setEndMonth(endMonth);
        R<Boolean> result = remoteMonthEmpStatisService.batchComputer(monthEmpStatisBatchQueryVo);
        if(Constants.FAIL == result.getCode()){
            throw new ServiceException(result.getMsg());
        }
    }

}
